using System;
using Terra.Service.Common.Models;

namespace Terra.Service.Common.Base;

/// <summary>
/// 应用服务标记接口
/// </summary>
public interface IAppService
{
}

/// <summary>
/// 基础应用服务接口
/// </summary>
public interface ICrudAppService<TDto, in TKey> : IAppService
    where TDto : class
{
    /// <summary>
    /// 获取实体
    /// </summary>
    Task<TDto> GetAsync(TKey id);

    /// <summary>
    /// 获取分页列表
    /// </summary>
    Task<PagedResultDto<TDto>> GetListAsync(PagedRequestDto input);

    /// <summary>
    /// 创建实体
    /// </summary>
    Task<TDto> CreateAsync(TDto input);

    /// <summary>
    /// 更新实体
    /// </summary>
    Task<TDto> UpdateAsync(TKey id, TDto input);

    /// <summary>
    /// 删除实体
    /// </summary>
    Task DeleteAsync(TKey id);
}